<?php

namespace app\api\validate;

use think\Validate;

class Campaign extends Validate
{
    /**
     * 验证规则
     */
    protected $rule = [
        'name'=> 'require|length:2,50',
        'age' => 'number|between:1,120',
        'avatar' => 'require',
        'job' => 'length:1,20',
        'nation'=>'require|length:1,10',
        'politic'=>'require|in:1,2,3',
        'introduction'=> 'require'
    ];
    /**
     * 提示消息
     */
    protected $message = [
        'name.require'  => '姓名不可为空',
        'name.length'   => '姓名长度应在2-50之间',
        'age.between'   => '年龄应该在1-120之间',
        'avatar.require'=> '头像不可为空',
        'job.length'    => '工作最长20个字符',
        'nation.require'=> '民族不可为空',
        'nation.length' => '民族长度应在10字以内',
        'politic.in'    => '政治面貌参数错误',
        'introduction.require'  => '简介不可为空'
    ];
    /**
     * 验证场景
     */
    protected $scene = [
        'add'  => [],
        'edit' => [],
    ];
    
}
